const qs = require('qs')
const fs = require('fs')

module.exports = function (app) {
	app.get('/api/pdf', (req, res) => {
		const { file } = qs.parse(req.query)
		console.log('file', file)
		const addr = __dirname + '/' + file
		console.log('addr', addr)
		fs.createReadStream(addr).pipe(res)
		// fs.readFile('./' + file, (error, data) => {
		// 	res.end(data)
		// })
	})
}
